<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<div id="log"></div>
<script>
test(() => assert_selection(
    '<div contenteditable>|</div>',
    selection => {
        selection.document.execCommand('insertText', false, 'foo');
        selection.document.execCommand('undo');
        selection.document.execCommand('redo');
    },
    '<div contenteditable>foo|</div>'),
    'Redo insertText on empty editable');

test(() => assert_selection(
    '<div contenteditable>fo|o</div>',
    selection => {
        selection.document.execCommand('insertText', false, 'bar');
        selection.document.execCommand('undo');
        selection.document.execCommand('redo');
    },
    '<div contenteditable>fobar|o</div>'),
    'Redo insertText on non-empty editable');
</script>
